<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/views/common/taglibs.jsp" %>

<!DOCTYPE>
<html>
<head>
    <!-- 引入通用js、css文件(xiaogq) -->
    <meta name="decorator" content="bootstrap"/>
</head>
<body>
    <div class="entity_div">
        <table id="field_table1"
               data-striped="true"
               data-toggle="table"
               data-show-columns="false"
               data-cookie="false"
               data-pagination="false"
               data-search="false"
               data-url="${ctx}/FieldRecord/queryRestrictFields.do?fieldId=${fieldId}&resFieldId=${resFieldId}"
               data-side-pagination="server"
               data-checkbox-header="true"
               data-page-list="[10,20,30,1000]"
               class="table">
            <thead>
            <tr>
                <th data-field='operation' data-formatter='showColOperator' data-width="120px" data-align="center">操作</th>
                <th data-field='id' data-visible='false'>ID</th>
                <th data-field='resFieldName' data-sortable='false' data-width="280px">${resFieldLocal}</th>
                <th data-field='fieldName' data-sortable='false'>${fieldLocal}</th>
            </tr>
            </thead>
        </table>
    </div>
    <script type="text/javascript">
        //绑定表格列前操作(xiaogq)
        function showColOperator(v,row) {
            //console.log("v====",v,"&row======",row);
            var btn = '';
            for(var i = 0; i < v.length; i++){
                var childName = row.resFieldName == undefined ? "" : row.resFieldName;
                btn += "<a href='javascript:void(0);' id='"+row.id+"' tableCode='"+v[i].entityRecord.tableCode+"' title='"+v[i].name+"' name='"+childName+"' url='"+v[i].url+"' onclick='"+v[i].method+"(this)'><span class='"+v[i].icon+"' style='padding-right: 5px;'></span></a>";
            }
            return btn;
        }
        //枚举值约束关系编辑方法(xiaogq)
        function editRestrictField(node){
            var resOptionId = $(node).attr("id");
            var resOptionName = $(node).attr("name");
            var resFieldId = "${resFieldId}";
            var resFieldLocal = "${resFieldLocal}";
            var fieldId = "${fieldId}";
            //alert("resFieldId==="+resFieldId+"&fieldId=="+fieldId+"&resOptionId=="+resOptionId);
            var fieldLocal = "${fieldLocal}";
            var url = Constants.fieldRestrictedEditUrl+"?fieldId="+fieldId+"&fieldLocal="+fieldLocal+"&resFieldId="+resFieldId+"&resOptionId="+resOptionId+"&resOptionName="+resOptionName;
            //打开tabls标签
            //parent.addMenu(node,{title:"约束关系:"+resFieldLocal+":"+resOptionName,url:url,type:"R"});
            var node = {id: "editRestrictField"+resOptionId, text: "约束关系:"+resFieldLocal+":"+resOptionName, url:url};
            //打开tabls标签
            parent.showTab(node);
        }
    </script>
</body>
</html>
